/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufba.lasid.v1.jitclouds.mda.datatypes.virtualization;

import br.ufba.lasid.v1.jitclouds.mda.MDA;
import br.ufba.lasid.v1.jitclouds.mda.utils.Shell;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author aliriosa
 */
public class ShellCommandBasedVirtualMachine extends BasicVirtualMachine {    
     
    @Override
    public void execute(String action) {        
        String cmdShell = getCommand(action);
        try {
            Shell.execute(cmdShell);
        } catch (Exception ex) {
            Logger.getLogger(XenVirtualMachine.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
    
    public String getCommand(String action){
        //action = "action." + action;
        String cmdShell = getConfiguration().get(action);
        cmdShell = String.format(cmdShell, getID());
        return cmdShell;
    }
    
}
